package com.neusoft.tijian.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.neusoft.tijian.po.Hospital;
import com.neusoft.tijian.service.HospitalService;

/**
 * 医院相关
 */
@RestController
@RequestMapping("/hospital")
public class HospitalController {

	@Autowired
	private HospitalService hospitalService;

	/**
	 * 医院列表(营业状态)
	 * @param hospital
	 * @return
	 */
	@RequestMapping("/listHospital")
	public List<Hospital> listHospital(@RequestBody Hospital hospital) throws InterruptedException {
		return hospitalService.listHospital(hospital.getState());
	}

	/**
	 * 根据医院id获取，医院信息 (用于订单页面，展示医院详情信息)
	 * @param hospital
	 * @return
	 */
	@RequestMapping("/getHospitalById")
	public Hospital getHospitalById(@RequestBody Hospital hospital) {
		return hospitalService.getHospitalById(hospital.getHpId());
	}
}
